{template 'common/header'}
<script language="JavaScript" src="{MODULE_URL}template/public/js/delete.js"></script>
<div>
    <!-- Nav tabs -->
    <ul class="nav nav-tabs" role="tablist">
        <li role="presentation" {if $op=="list"}class="active"{/if}><a href="{php echo $this->createWebUrl('news',array('op'=>'list'));}">动态列表</a></li>
        <li role="presentation" {if $op=="category" || $op=="category_add"}class="active"{/if}><a href="{php echo $this->createWebUrl('news',array('op'=>'category'));}">动态分类</a></li>
    </ul>
    <!-- Tab panes -->
    {if $op == 'list'}
    <!--列表循环开始-->
    <div class="clearfix">
        <form action="" method="get" class="we7-form" role="form">
            <input type="hidden" name="c" value="site">
            <input type="hidden" name="a" value="entry">
            <input type="hidden" name="do" value="news">
            <input type="hidden" name="m" value="dgjy"/>
            <input type="hidden" name="cateid" value="{$_GPC['cateid']}">
            <div class="form-group">
                <label class="col-sm-2 control-label">分类</label>
                <div class="form-controls col-sm-8">
                    <div class="btn-group we7-btn-group">
                        <a href="{php echo filter_url('cateid:0');}" class="btn {if $_GPC['cateid'] == 0}btn-primary{else}btn-default{/if}">不限</a>
                        {loop $categorys $category}
                        <a href="{php echo filter_url('cateid:' . $category['id']);}"
                           class="btn {if $_GPC['cateid'] == $category['id']}btn-primary{else}btn-default{/if}">{$category['title']}</a>
                        {/loop}
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">标题</label>
                <div class="input-group col-sm-4 pull-left">
                    <input class="form-control" name="title" id="" type="text" value="{$_GPC['title']}">
                    <div class="input-group-btn">
                        <button class="btn btn-default"><i class="fa fa-search"></i></button>
                    </div>
                </div>
                <div class="pull-right">
                    <a href="javascript:;" data-toggle="modal" data-target="#displaysetting" class="btn btn-primary">排序设置</a>
                    <a href="{php echo $this->createWebUrl('news',array('op'=>'news_post'));}" class="btn btn-primary">添加动态</a>
                </div>
            </div>
        </form>
        <table class="table we7-table table-hover">
            {template 'news/news_top'}
            <tbody>
            {loop $news $new}
            {template 'news/news_item'}
            {/loop}
            </tbody>
        </table>
        <div class="modal fade" id="displaysetting" tabindex="-1" role="dialog" aria-hidden="true">
            <div class="we7-modal-dialog modal-dialog we7-form">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                        <div class="modal-title">修改新闻排序设置</div>
                    </div>
                    <form action="" method="get">
                        <input type="hidden" name="c" value="site">
                        <input type="hidden" name="a" value="entry">
                        <input type="hidden" name="do" value="news">
                        <input type="hidden" name="m" value="dgjy"/>
                        <div class="modal-body">
                            <div class="form-group">
                                <select name="setting" class="we7-select">
                                    <option value="createtime desc">按添加时间倒序</option>
                                    <option value="createtime asc">按添加时间正序</option>
                                    <option value="displayorder desc">按排序数字大小倒序</option>
                                    <option value="displayorder asc">按排序数字大小正序</option>
                                </select>
                                <span class="help-block"></span>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <button name="submit" class="btn btn-primary" value="submit">确定</button>
                            <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <div class="text-right">
            {$pager}
        </div>
    </div>
    <!--列表循环结束-->
    {elseif $op == 'category'}
    {template 'news/news_category'}
    {/if}
</div>
{template 'common/footer'}
